package com.myorg.search;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.myorg.service.ScanService;
import com.myorg.service.StartupService;

@WebServlet("/DoScan")
public class DoScan extends HttpServlet {
	private static final long serialVersionUID = 1L;

	final Logger logger = LoggerFactory.getLogger(DoScan.class);

	public DoScan() {
		super();
	}

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
			IOException {
		StartupService.touch();
		String source = request.getParameter("source");
		String startS = request.getParameter("start");
		String endS = request.getParameter("end");
		new ScanService().doScan(source, startS, endS);
	}
}
